package tcp_server;

import java.io.IOException;
import java.util.HashMap;

public class TcpDictServer extends TcpEchoServer{
    HashMap<String,String> hashMap = new HashMap<>();

    public TcpDictServer(int port) throws IOException {
        super(port);
        hashMap.put("学者","scholar");
        hashMap.put("电话","phone");
        hashMap.put("西瓜","watermelon");
    }

    @Override
    public String process(String request) {
        return hashMap.getOrDefault(request,"您查找的单词不存在!!");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer server = new TcpDictServer(9090);
        server.start();
    }
}
